package gov.nih.nlm.lowlinc.accessionwrapper;

import gov.nih.nlm.lowlinc.owlapi.LowlincException;

import org.semanticweb.owlapi.model.OWLClassExpression;

public class LOINCPartID extends LOINCID {

	private String label = null;
	private String type = null;

	public LOINCPartID(String id) throws LowlincException {
		super(id);
	}

	public LOINCPartID(OWLClassExpression subclass) throws LowlincException {
		super(subclass);
	}

	protected void validateID() throws LowlincException {
		if (!getID().startsWith("LP")) {
			throw new LowlincException(getID() + " partID looks like termID");
		}
	}

	public void setVerboseOutput(String label, String type) {
		this.label = label;
		this.type = type;
	}

	@Override
	public String toString() {
		if (label == null) {
			return "LOINC Part (" + getID() + ")";
		} else {
			return label + "(" + type + " " + getID() + ")";
		}
	}

}
